package org.gary.admin.model;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * 日志
 * @author lengreen
 *
 */
@Entity
public class Logger implements lengreen.core.interfaces.Entity {
	/**
	 * 重写toString方法
	 */
	@Override
	public String toString() {
		return "Logger [createDate=" + createDate + ", doWhat=" + doWhat
				+ ", id=" + id + ", target=" + target + "]";
	}

	private int id;
	/**对谁做了操作*/
	private String target;
	/**做了什么操作*/
	private String doWhat;
	
	private Date createDate;//操作时间

	public Logger() {
		setCreateDate(new Date());
	}
	
	/**
	 * 构造方法
	 * @param target
	 * @param doWhat
	 */
	public Logger(String target, String doWhat) {
		this.target = target;
		this.doWhat = doWhat;
		setCreateDate(new Date());
	}
	
	/**
	 * 构造方法
	 * @param target
	 * @param doWhat
	 * @param date
	 */
	public Logger(String target, String doWhat, Date date) {
		this.target = target;
		this.doWhat = doWhat;
		this.createDate = date;
	}
	
	@Id
	@GeneratedValue
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getDoWhat() {
		return doWhat;
	}

	public void setDoWhat(String doWhat) {
		this.doWhat = doWhat;
	}

	public String getTarget() {
		return target;
	}

	public void setTarget(String target) {
		this.target = target;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	@Temporal(TemporalType.TIMESTAMP)
	public Date getCreateDate() {
		return createDate;
	}
}
